<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2018/4/9
 * Time: 13:43
 */

namespace app\index\controller;


use think\Controller;

class Research extends GetSlides
{
    public function scientific_research()
    {
        $this->get_slider();//返回banner
        $cates = [
            ['id' => '140fb83f-1932-4874-bc15-386741790415', 'page_limit' => 1], //科研概况
            ['id' => '6de70d44-18ca-4dc6-9924-e12d356280d5', 'page_limit' => 4], //科研动态
            ['id' => array_search('科研平台',COLUMNS), 'page_limit' => 6], //科研平台
            ['id' => '6faafce8-497d-4e37-8cf0-39decbef1c95', 'page_limit' => 5], //科研项目
            ['id' => 'ecadfbb1-2f68-4a7e-87fe-ea3857d55d6a', 'page_limit' => 5], //科研成果
        ];
        $A = new Api();
        $data = [];
        card_info_special_page($A, $cates, $data);
        $team = $A->get_d_d_detail('63414925-4e1c-4b61-9f66-fd2d4f8078ea');
        $team = getImg($team);
        //科研概况 获取文章信息
        $kygk = $A->get_p_detail(ARTICLE['科研概况']);
        $kygk = getImg($kygk);
        $kygk_text = strip_tags($kygk['data'][0]['attributes']['body']['value']);
        $kygk_img = $kygk['data'][0]['attributes']['imageurl'];
        //科研平台 获取分类信息
        $kypt = $A->get_menu('platforms');
        $kypt = getImg($kypt);
        $GLOBALS['dar1'] = 'ky';
        $this->assign(
            [
                "kygk" => $kygk_text,
                "kygk_img" => $kygk_img,
                "platform" => $kypt['data'],
                "team" => $team['data'],
                "id" => '63414925-4e1c-4b61-9f66-fd2d4f8078ea'
            ]);
        $this->assign($data);
        $this->assign("web_title", "科研");
        return view();
    }

    public function scientific_plantform()
    {
        $web_title =array_search(input('param.id'),PLATFORM);
        $A = new Api();
        $plat_id = input('get.id');
        $plat = $A->get_detail('platforms', $plat_id, 0);
        $plat = getImg($plat);
        $doctor = $A->get_platform_doctor($plat_id);
        $doctor = array_slice($doctor,0,6);
        $doctor = getImg($doctor);
        $gain = $A->get_platform_article($plat_id, '科研成果', 1,5);
        $news = $A->get_platform_article($plat_id, '科研动态', 1,5);
        $this->assign([
            "web_title" => $web_title,
            "platform_id" => $plat_id,
            "gain_id" => array_search('科研成果',COLUMNS),
            "news_id" => array_search('科研动态',COLUMNS),
            "introduce" => $plat['data'],
            "team" => $doctor['data'],
            "gain" => $gain['data'],
            "news" => $news['data']
        ]);
        return view();
    }

}
